package org.project.d.network.msg;


import org.project.d.network.Connection;
import org.project.d.network.msg.serializer.DeSerialized;
import org.project.d.network.protocol.Packet;

import java.util.Optional;

/**
 * @author lin
 * @version V1.0
 * @description
 * @date 2020/6/10 3:10 下午
 */
public interface Message {
    <T> T decodeBody(Class<T> tClass);

    <T> T decodeBody(Class<T> tClass, DeSerialized deSerialized);

    byte[] encodeBody();

    Packet getPacket();

    Connection getConnection();

    CommandCode getMsgType();

    <T> Optional<T> getBodyObj();
}
